package com.unionServer.gateway;

import com.unionServer.codecs.UnionEncoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BackEndHandlerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO));
        ch.pipeline().addLast(new UnionEncoder());
       // ch.pipeline().addLast(new UnionDecoder(Integer.MAX_VALUE, 0, 4, 0, 0, false));
        ch.pipeline().addLast(new BackendHandler());
    }
}
